import request from "../http";
import uploadFile from "../uploadFile";

/**
 * 政策首页 policy
 */

// 获取申报中政策
export function getDoingPolicys(query) {
  return request({
    url: "/policy/policy/list",
    method: "GET",
    params: query
  });
}

// 获取搜索类型和热词
export function getSearchTypeAndHotWords() {
  return request({
    url: "/policy/policy/searchHome",
    method: "GET"
  });
}

// 获取兑现结果公示政策信息 
export function getAnnounces(query) {
  return request({
    url: "/policy/redemption/announce",
    method: "GET",
    params: query
  });
}

/**
 * 政策兑现 policyCash
 */

// 获取政策信息 
export function getPolicys(query) {
  return request({
    url: "/policy/policy/recommendlist",
    method: "GET",
    params: query
  });
}

/**
 * 政策详情 policyDetail
 */

// 获取政策信息
export function getPolicyDetail(policyId) {
  return request({
    url: "/policy/policy/" + policyId,
    method: "GET"
  });
}

// 下载政策文件
export function downloadFile(url,filename) {
  return request({
    url: `/system/file/download?fileUrl=${url}&fileName=${filename}`,
    method: "GET",
    responseType: "blob"
  });
}

/**
 * 政策列表 policyList
 */

// 获取政策列表信息
export function getPolicyList(query) {
  return request({
    url: `/policy/policy/list`,
    method: "GET",
    params: query
  });
}

// 获取顶部搜索栏的数据 /policy/policy/policydict
export function getPolicydict(params) {
  return request({
    url: `/policy/policy/policydict`,
    method: "GET",
    params
  });
}

/**
 * 政策列表-智能推荐 policyRecommend
 */

// 获取政策列表信息(智能推荐)
export function getPolicyListRe(query) {
  return request({
    url: `/policy/policy/recommendlist`,
    method: "GET",
    params: query
  });
}

/**
 * 政策搜索 policySearch
 */

// 获取查询结果
export function getPolicySearch(query) {
  return request({
    url: `/policy/policy/search`,
    method: "GET",
    params: query
  });
}

/**
 * 政策申报 policySend
 */

// 申报政策
export function sendPolicy(data) {
  return request({
    url: `/policy/apply/addItem`,
    method: "POST",
    data
  });
}